﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RPCServer.Core
{
    class TimeSystem
    {
        const int MS2TICK_UNIT = 10000;

        #region Ticks
        public static long GetTicks(int ms)
        {
            return ms * MS2TICK_UNIT;
        }

        public static long IncTicks(long tick, int ms)
        {
            return tick + ms * MS2TICK_UNIT;
        }

        public static long IncTicks(long tick, long ms)
        {
            return tick + ms * MS2TICK_UNIT;
        }
        public static long ReduceTicks(long tick, int ms)
        {
            return tick - ms * MS2TICK_UNIT;
        }
        public static long ReduceTicks(long tick, long ms)
        {
            return tick - ms * MS2TICK_UNIT;
        }

        public static long NextTicks(int intervalMs)
        {
            return DateTime.UtcNow.Ticks + intervalMs * MS2TICK_UNIT;
        }

        public static long NextTicks(long intervalMs)
        {
            return DateTime.UtcNow.Ticks + intervalMs * MS2TICK_UNIT;
        }
        #endregion
    }
}
